🗂️ ConstructQ · Task Management ER Diagram (v36.0)

Reference: ConstructQ_TaskManagement(QC+NCR)_v36.0.html · 11 tables · 22 REST endpoints · 7 sample tasks
Enum
Task core
Runtime data
Audit
NCR

Enum

task_states 7
id PKVARCHAR
name_th / name_enVARCHAR
color_bg / color_fgVARCHAR
is_terminalBOOL
sort_orderINT
task_priorities 4
id PKVARCHAR
name_th / name_enVARCHAR
colorVARCHAR

Task core

tasks 7 sample
id PKBIGSERIAL
codeVARCHAR UQ
project_id FKBIGINT
zone_code / wbs_codeVARCHAR
checklist_id FKBIGINT
workflow_id FKBIGINT
name_th / name_enVARCHAR
priority FKVARCHAR
state FKVARCHAR
current_step / due_dateINT/DATE

Runtime

task_step_assignees
id PKBIGSERIAL
task_id FKBIGINT
step_idINT
assignee_emailVARCHAR
assigned_atTIMESTAMPTZ
task_step_history
id PKBIGSERIAL
task_id FKBIGINT
step_id / resultINT/VARCHAR
completed_atTIMESTAMPTZ
actor_name / notesTEXT
task_answers
id PKBIGSERIAL
task_id FKBIGINT
question_id FKBIGINT
value_textTEXT
verdict / reasonVARCHAR/TEXT
task_photos
id PKBIGSERIAL
task_id FKBIGINT
answer_id FKBIGINT NULL
url / captionTEXT

Audit

task_audit_log ~54
id PKBIGSERIAL
task_id FKBIGINT
tsTIMESTAMPTZ
actor_name / roleVARCHAR
actionVARCHAR
detailTEXT
ipINET

NCR

ncrs
id PKBIGSERIAL
codeVARCHAR UQ
task_id FKBIGINT
answer_id FKBIGINT
severity / statusVARCHAR
assigned_to / due_dateFK/DATE
ncr_photos
id PKBIGSERIAL
ncr_id FKBIGINT
phasebefore/after
url / captionTEXT
ncr_history
id PKBIGSERIAL
ncr_id FKBIGINT
from_status / to_statusVARCHAR
ts / actor_idTIMESTAMPTZ/FK
N:1 · tasks.checklist_idchecklist_deployments.id
N:1 · tasks.workflow_idworkflow_deployments.id
N:1 · tasks.statetask_states.id · tasks.prioritytask_priorities.id
1:N · tasks.idtask_step_assignees.task_id · task_step_history.task_id · task_audit_log.task_id · CASCADE
1:N · tasks.idtask_answers.task_id · task_photos.task_id · ncrs.task_id · CASCADE
1:1 · ncrs.answer_idtask_answers.id · origin of auto-raised NCR
1:N · ncrs.idncr_photos.ncr_id (before/after) · ncr_history.ncr_id · CASCADE

📋 Sample: task_states (7 rows · canonical enum)

idname_thchip
createdสร้างงานcreated
assignedมอบหมายแล้วassigned
in_progressกำลังตรวจin_progress
reviewรอตรวจสอบreview
doneเสร็จสิ้นdone
blockedติดขัดblocked
rejectedตีกลับrejected

🔧 Sample: tasks (7 sample tasks covering all lifecycle states)

codeproject · WBS · zonename_thprioritystatestepdue
TQ-2026-054office · 2.1 · Z-5ตรวจงานสี ชั้น 5 โซน Ahighin_progress22026-07-07
TQ-2026-055office · 1.2 · Z-Gตรวจคอนกรีต Lobbynormalrejected42026-07-01
TQ-2026-056office · 3 · Z-Rตรวจระบบไฟฟ้า ดาดฟ้าlowassigned12026-07-15
TQ-2026-050office · 1.1 · Z-B2ตรวจเสาเข็ม ใต้ดิน 2done7
TQ-2026-057office · 1.1 · Z-B3ตรวจเสาเข็มเจาะ B3 (คู่)created0
TQ-2026-058office · 2.1 · Z-Lตรวจงานสี · Lobby (รอเช็คซ้ำ)review3
TQ-2026-059office · MEP · Z-5ตรวจระบบประปา ชั้น 5blocked2

👥 Sample: task_step_assignees (TQ-2026-054 · 6 step assignments)

task_codestep_idassignee_emailrole
TQ-2026-054 1son.p@tarnas.co.thQCM
2kittisak.c@tarnas.co.thQC (current)
3son.p@tarnas.co.thQCM
4apinya.w@tarnas.co.thEngineer
5narong.b@tarnas.co.thPM
6apinya.w@tarnas.co.thEngineer (final)

📜 Sample: task_audit_log (TQ-2026-054 · first 7 entries)

tsactorroleactiondetail
2026-06-25 09:00:00Son PrasertsriQCMtask.createdสร้าง Task จาก Checklist 'ตรวจงานสี v1.0'
2026-06-25 09:00:01Systemworkflow.linkedผูก Workflow: มาตรฐาน QC (7 ขั้นตอน)
2026-06-25 09:00:01Systemchecklist.linkedผูก Checklist: ตรวจงานสี v1.0
2026-06-26 08:30:11Son PrasertsriQCMtask.assignedมอบหมาย Step 2 → Kittisak Chaiwatn
2026-06-26 08:31:00Systemnotification.sentEmail แจ้ง Kittisak Chaiwatn
2026-06-27 09:15:24Kittisak ChaiwatnQCtask.receivedรับงาน · เริ่มเข้าตรวจหน้างาน
2026-06-27 09:15:25Systemstate.changedเปลี่ยนสถานะ: assigned → in_progress

⚠️ Sample: ncrs (auto-raised from failed checklist answers)

codetask_codetitleseveritystatusassigned_to
NCR-2026-041TQ-2026-055Slump ต่ำกว่ามาตรฐาน 1.5 cmmajorclosedApinya W.
NCR-2026-042TQ-2026-055Cover concrete ที่คาน B4 < 40 mmcriticalin_progressNarong B.
NCR-2026-043TQ-2026-057Bar Bending Schedule ไม่ตรงแบบmajoropenKittisak C.